package com.cloud.rabbitmq.controller;

import com.cloud.rabbitmq.entity.User;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class MqTest1Controller {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("streamPush")
    public String streamPush(@RequestParam String key){
        rabbitTemplate.convertAndSend("htDirectExchange",key,new User("123","liwenjian","123"),new CorrelationData("123"));
        return "hehe";
    }

}
